package com.yxx.strategy.context;

import com.yxx.entityModel.vo.request.CodeRequest;
import com.yxx.enums.LoginTypeEnum;
import com.yxx.strategy.LoginStrategy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 登录策略上下文
 * @author yuxiangxun
 * @date 2025/2/5
 * @apiNote
 */
@Service
public class LoginStrategyContext {
    @Resource
    private Map<String, LoginStrategy> LoginStrategyMap;

    public String executeLoginStrategy(CodeRequest data, LoginTypeEnum loginTypeEnum){
        return LoginStrategyMap.get(loginTypeEnum.getStrategy()).login(data);
    }
}
